﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TagProductList.aspx.cs" Inherits="ZLCMS.Web.SystemManage.Basics.TagProductList" %>

<%@ Import Namespace="ZLCMS.Business.Util" %>
<%=_framePage.GetPagerFormHtml(Request.RawUrl)%>
<form id="pageForm" method="post" class="pageForm" runat="Server">
<input id="hid_uid" cond="uid" runat="server" type="hidden" />
<%=_framePage.TabInfoHtml()%>
<div class="pageHeader">
    <div class="searchBar">
        <ul class="searchContent" style="height: 50px;">
            <li><span>商品名称&nbsp;</span>
                <asp:textbox id="tb_search_name" runat="server" cond="name" ctltype="textbox"></asp:textbox>
                &nbsp;&nbsp; </li>
            <li><span>商品代码&nbsp;</span>
                <asp:textbox id="tb_search_productno" runat="server" cond="pno" ctltype="textbox"></asp:textbox>
                &nbsp;&nbsp; </li>
            <li><span>状态&nbsp;</span>
                <asp:dropdownlist runat="server" id="ddl_status" cond="status" ctltype="dropdownlist"
                    width="150px">
                </asp:dropdownlist>
            </li>
            <li><span>产品类型&nbsp;</span>
                <asp:dropdownlist runat="server" id="ddl_product_kind" cond="productkind" ctltype="dropdownlist"
                    width="150px">
                </asp:dropdownlist>
            </li>
          
        </ul>
     
        <div class="subBar">
        <span style="height: 25px; line-height: 25px;">标签名称：<%= tagInfo.TagName %>&nbsp;&nbsp;&nbsp;&nbsp;标签内部名称：<%= tagInfo.TagInternalName %>&nbsp;&nbsp;&nbsp;&nbsp;标签描述：<%= tagInfo.Content %></span>
            <ul>
            
                <li><a class="buttonActive" href="<%= Request.Path %>" onclick="ZLAN_DWZ_EX.query(this);"
                    target="navTab" rel="<%= _framePage.NavTabId %>" title="<%= _framePage.NavTabTitle %>">
                    <span>&nbsp;检&nbsp;索&nbsp;</span></a>&nbsp;&nbsp; </li>
            </ul>
        </div>
    </div>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href='/SystemManage/Basics/shop/taginfo/SetProductTag.aspx?ajax=sets&tid=<%=_uid %>&status=1'
                target="selectedTodo"  title="产品标签-增加"><span>为勾选产品添加标签</span></a></li>
                
            <li><a class="delete" href="/SystemManage/Basics/shop/taginfo/SetProductTag.aspx?ajax=sets&tid=<%=_uid %>&status=0" target="selectedTodo" title="请确定要删除产品标签"><span>删除勾选产品标签</span></a></li>
        </ul>
    </div>
    <div class="tableList" layouth="140">
        <table class="list" targettype="navTab" asc="asc" desc="desc">
            <thead>
                <tr>
                    <th width="22px">
                        <input onchange="" type="checkbox" group="ids" class="checkboxCtrl" id="SelelctAllPro" />
                    </th>
                    <th width="80px">
                        缩略图
                    </th>
                    <th width="120px">
                        商品编码
                    </th>
                    <th width="120px">
                        内部编码
                    </th>
                    <th width="140px">
                        商品名称
                    </th>
                    <th width="100px">
                        所属分类
                    </th>
                       <th width="100px">
                        产品类型
                    </th>
                    <th width="100px">
                        库存
                    </th>
                    <%--<th width="120px">
                        SKU商品数量
                    </th>--%>
                    <th width="100px">
                        市场价
                    </th>
                    <th width="100px">
                        会员价
                    </th>
                    <th width="80px">
                        状态
                    </th>
                    <th width="140px" align=center>
                        操作
                    </th>
                </tr>
            </thead>
            <tbody>
                <asp:repeater runat="server" id="grid">
                <ItemTemplate>
			    <tr target="uid" rel='<%# Eval("Id")%>'>
                    <td><input id="ckb_<%# Eval("ProductNo")%>" onchange="" pno='<%# Eval("ProductNo") %>' name="ids" class="product_checkbox" value="<%#Eval("ProductNo")%>" type="checkbox"/></td>
				    <td height="80px"><img src="<%# GetPicture( FileKit.FirstFilePath(Eval("ThumbnailImg").ToString())) %>" alt="" width="80px" /></td>
				    <td><%# Eval("ProductNo")%></td>
                    <td><%# Eval("InteriorCode")%></td>
				    <td><%# Eval("ProductName")%></td>
				    <td><%# ParamKit.GetValue("ProductType", Eval("TypeId").ToString(), "&nbsp")%></td>
                     <td><%# ParamKit.GetValue("ProductKind", Eval("Kind").ToString(), "&nbsp")%></td>
                    <td><%#Eval("Storage")%></td>
                    <%--<td><%#GetSkuProductCount(Eval("ProductNo"))%></td>--%>
				    <td><%# Eval("MarketPrice", "{0:0.00}") %></td>
				    <td><%# Eval("SalePrice", "{0:0.00}") %></td>
                    <td><%# (string)Eval("Status") == "1" ? "上架中" : "下架中"%></td>
				       <td  align=center> 
				   <a href="/SystemManage/Basics/ProductSKU/ProductEdit.aspx?pid=<%# Eval("Id")%>" onclick="ZLAN_DWZ_EX.open(this);" target="navTab" title="产品-编辑" rel="editptmember">编辑产品</a>&nbsp;&nbsp;

                   <%# GetStatusHtml(Eval("TagIds") == null ? "" : Eval("TagIds").ToString(), Eval("ProductNo") == null ? "" : Eval("ProductNo").ToString())%>

                    

                         <%-- <a href="/SystemManage/Basics/ProductSKU/ProductDelete.aspx?ids=<%# Eval("Id")%>" target="ajaxTodo" title="请确定要删除">删除</a>&nbsp;&nbsp;
                       
				    </td>--%>
			    </tr>
                </ItemTemplate>
            </asp:repeater>
            </tbody>
        </table>
    </div>
    <%= _framePage.GetPagerContentHtml()%>
</div>
<script type="text/javascript">
    function SetSinglePro(el) {
    var status='0';
    var ct = $(el);
        if(ct.attr("checked"))
        {
        status='1';
        }
    SetProductsTag(el,$(el).attr("pno"), "single", status);
    }
    function SetSelectedPro(el) {
        var status = '0';
        var ct = $(el);
        if (ct.attr("checked")) {
            status = '1';
        }
        var cbkList = $("input[name=ids][class=product_checkbox]");
        var pnostr = '';
        $(cbkList).each(function () {
            pnostr += $(this).attr("pno")+',';
        });
        pnostr.substring(0, pnostr.length-1);
        SetProductsTag(el, pnostr, "selected", status);
    }

    function SetProductsTag(el,pnos,type,status) {
        $(el).ExecuteCommand({
            successCallBack: function (result) {
            
            },
            errorCallback: function (errorCode, msg) {
                if (type == 'single') {
                    $(el).attr("checked", !$(el).attr("checked"));
                }
                else {
                    $(el).attr("checked", !$(el).attr("checked"));
                    var cbkList = $("input[name=ids][class=product_checkbox]");
                    $(cbkList).each(function () {
                        $(this).attr("checked", !$(this).attr("checked"));
                    });
                }
                alert(msg);
            }
        }, 'SetProductTag', { ProductNos: pnos, Type: type, TagId: '<%=_uid %>', Status: status });
    }
</script>
</form>
